package game
{
	
	import game.constants.ApplicationNotification;
	import game.constants.items.notif.ItemNotification;
    import org.puremvc.as3.interfaces.IFacade;
    import org.puremvc.as3.patterns.facade.Facade;
	import game.controller.*;
	import game.controller.items.*;
	import game.controller.globalVar.*;
	import game.controller.gameEvent.*;
	import game.controller.unit.UnitTestsCommand;
	
	
	/**
	 * ...
	 * @author Thot
	 */
    
    public class ApplicationFacade extends Facade implements IFacade
    {
		
		// Singleton ApplicationFacade Factory Method
        public static function getInstance(): ApplicationFacade
        {
            if (instance == null)
            {
				instance = new ApplicationFacade( );
			}
			
            return instance as ApplicationFacade;
        }
		
		
		public function startApp():void
		{
			sendNotification( ApplicationNotification.START_APP );
		}
		
        // Register Commands with the Controller 
        override protected function initializeController():void
        {
            super.initializeController(); 
			
			registerCommand( ApplicationNotification.START_APP, 				StartApplicationCommand 		);
			registerCommand( ApplicationNotification.BUY_ITEM, 					BuyItemCommand 					);
			registerCommand( ApplicationNotification.PUSH_ITEM, 				PushItemCommand					);
			registerCommand( ApplicationNotification.LAUNCH_TRIGGER, 			LaunchGameEventCommand			);
			registerCommand( ApplicationNotification.SET_GLOBAL_VAR, 			SetGlobalVarCommand				);
			registerCommand( ApplicationNotification.LOAD_GAME_DATA, 			LoadGameDataCommand				);
			registerCommand( ApplicationNotification.LOAD_GAME_DATA_COMPLETE, 	InitGameConfigCommand			);
			registerCommand( ApplicationNotification.UPDATE_DATA, 				UpdateBuildingsCommand			);
			registerCommand( ApplicationNotification.INCREASE_BUILDING, 		IncreaseBuildingLevelCommand	);
			registerCommand( ApplicationNotification.ADD_BUILDING, 				AddBuildingCommand				);
			registerCommand( ApplicationNotification.CANNOT_BUY, 				CannotBuyCommand				);
			registerCommand( ApplicationNotification.START_TIMER, 				TimerCommand					);
			registerCommand( ApplicationNotification.STOP_TIMER, 				TimerCommand					);
			registerCommand( ApplicationNotification.RESET_TIMER, 				TimerCommand					);
			registerCommand( ApplicationNotification.START_GAME, 				StartGameCommand				);
			registerCommand( ApplicationNotification.START_EVOLUTION, 			StartBuildingEvolutionCommand	);
			
			// unit test
			registerCommand( ApplicationNotification.UNIT_TEST, 		UnitTestsCommand 			);
        }
		
    }
}